<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="/layui/css/layui.css">
</head>
<body>
<table id="demo" lay-filter="test"></table>
</body>
<script src="/layui/layui.all.js"></script>
<script src="/layui/js/jquery-3.5.1.js"></script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
    var table = layui.table;
    var laydate = layui.laydate;
    //第一个实例
    table.render({
        elem: '#demo'
        ,toolbar:true
        ,height: 312
        ,url: '/plist' //数据接口
        ,cols: [[ //表头
            {type: 'checkbox', fixed: 'left'}
            ,{field: 'postid', title: 'ID',  sort: true, fixed: 'left'}
            ,{field: 'postname', title: '岗位名称' }
            ,{field: 'posttype', title: '岗位类型' }
            ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
        ]]
        ,page: true //开启分页
    });

</script>
</html>